vtpm: Fix hashed-memory file writing.
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 24 Aug 2009 07:03:46 +0000 (08:03 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 24 Aug 2009 07:03:46 +0000 (08:03 +0100)
commit63afd80f48171e255e05e7ebcde732b555b597e5
treed5590c1372cce44cea196924def585c7af53e34c
parent0810208cf1478f58c401d9a37c52a4330f2246e4
vtpm: Fix hashed-memory file writing.

There is a bug in the vtpm_manager that has to do with hashing and
saving the NVM memory files (vtpm_dm_%d.data). The file is not
truncated when it is written and this results in the hash becoming
invalid because of the extra bits at the end of the file.

This patch adds O_TRUNC to the flags when opening the file.

More details on this issue are in the bug report on bugzilla=20
http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=3D1488

Signed-off-by: Matt Fioravante <Matthew.Fioravante@jhuapl.edu>
tools/vtpm_manager/manager/securestorage.c